import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ViewUI from 'view-design'
import {registerMicroApps, start, setDefaultMountApp, initGlobalState} from "qiankun";
import '../../common/css/reset.css'
import 'view-design/dist/styles/iview.css';
Vue.config.productionTip = false
Vue.use(ViewUI)
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

//初始化state
const actions = initGlobalState({
  a: 'vue-base'
})

registerMicroApps([
  {
    name: 'vueAdmin',
    entry: '//localhost:8088',
    container: '#container',
    activeRule: '#/vue-admin',
    props: {
      ha: 'hahahah',
      he: 'heheheh'
    }
  },
  {
    name: 'vueApp',
    entry: '//localhost:8089',
    container: '#container',
    activeRule: '#/vue-app'
  }
])
//主应用默认打开的子应用
setDefaultMountApp('#/vue-admin')

start({
  //子应用样式隔离
  sandbox: {
    // strictStyleIsolation: true,
    experimentalStyleIsolation: true
  },
  //预加载
  prefetch: () => {
    return {
      criticalAppNames: ['vueAdmin'],
      minorAppsName: ['vueApp']
    }
  },

})
